package com.heartbeat.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.commons.lang.StringUtils;

public class Connecter {
	
	private int maxTimeOut = 3000;
	
	public InputStream getInputStream(String webUrl) throws IOException{		
		URLConnection con = null;
		//con = ConnectionProxy.getInstance().getConnection(webUrl);
		
		URL url = new URL(StringUtils.trim(webUrl));
		con = url.openConnection();
		
		
		con.setRequestProperty( "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");
		con.setReadTimeout(this.getMaxTimeOut());
		
		InputStream is = con.getInputStream();
		
		return is;
	}
	
	public int getMaxTimeOut() {
		return maxTimeOut;
	}

	public void setMaxTimeOut(int maxTimeOut) {
		this.maxTimeOut = maxTimeOut;
	}
}
